package com.example.shopping_mall.utils;

import android.content.Context;
import android.util.Log;

import cn.jpush.android.api.CustomMessage;
import cn.jpush.android.api.NotificationMessage;
import cn.jpush.android.service.JPushMessageReceiver;

public class MyJPushMessageReceiver extends JPushMessageReceiver {
        private static final String TAG = "JPushReceiver";

        /**
         * 收到自定义消息的回调
         */
        @Override
        public void onMessage(Context context, CustomMessage customMessage) {
            super.onMessage(context, customMessage);
            Log.d(TAG, "onMessage: " + customMessage.toString());
        }

        /**
         * 点击通知/打开通知的回调
         */
        @Override
        public void onNotifyMessageOpened(Context context, NotificationMessage notificationMessage) {
            super.onNotifyMessageOpened(context, notificationMessage);
            Log.d(TAG, "onNotifyMessageOpened: ");
        }

        /**
         * 收到通知的回调
         */
        @Override
        public void onNotifyMessageArrived(Context context, NotificationMessage notificationMessage) {
            super.onNotifyMessageArrived(context, notificationMessage);
            Log.i(TAG, notificationMessage.toString());
        }

        /**
         * 清除通知的回调
         */
        @Override
        public void onNotifyMessageDismiss(Context context, NotificationMessage notificationMessage) {
            super.onNotifyMessageDismiss(context, notificationMessage);
            Log.d(TAG, "onNotifyMessageDismiss: ");
        }
    }
